<template>
	<view class="planContainer">
		<view class="testReport u-margin-40">
			<view class="title u-text-center">
				<text class="u-font-40 font-b">测评报告</text>
			</view>
			<view class="empty u-text-center">
				<image src="https://app.zbzedu.com/static/WaChat/images/noData.png" mode="" style="width: 292rpx;height: 292rpx;"></image>
			</view>
			<view class="notice u-text-center">
				<view class="">
					<text>暂未找到您的报告结果</text>
				</view>
				<view class="" style="margin: 10rpx 0;">
					请点击<text class="font-b" @click="toReport">开始测评</text>
				</view>
				<view class="">
					如已完成测评，请
					<text class="font-b" @click="rushReport">刷新报告结果</text>
				</view>
				<!-- 生成中显示 -->
				<view class="btns u-font-28">
					<view class="btn font-b" @click="toReport">开始测评</view>
					<view class="btn font-b" @click="rushReport" v-if="isShowBtn && showBtn" >刷新报告结果</view>
					<view class="btn font-b" style="background-color: #F0F0F0;color: #7B7B7B;" v-else >报告生成中</view>
				</view>
			</view>
		</view>
		<!-- 有数据时 -->
		<hasJob></hasJob>


		<!-- 选科要求 -->
		<CommonChoose></CommonChoose>
	</view>

</template>

<script>
	import {
		request
	} from "../../../util/api";
	import {
		CHECK_TOKEN
	} from '../../../util/util'
	import {
		TOAST
	} from "../../../util/util";
	import buyDetail from './buyDetail.vue'
	import CommonChoose from './CommonChoose.vue'
	import hasJob from './hasJob.vue'
	export default {
		props: {
			isShowBtn: {
				type: Boolean,
				default: true
			}
		},
		components: {
			buyDetail,
			CommonChoose,
			hasJob,
		},
		data() {
			return {
				isLogin: CHECK_TOKEN(),
				showBtn:true
			}
		},
		onShow() {
			uni.navigateBack({
				success:function(){
					 beforePage.onLoad();
				}
			})
		},
		created() {
		},
		methods: {

			// 跳转到开始测评页面
			toReport() {
				uni.navigateTo({
					url: "/package/pince/index"
				})
			},
			// 刷新报告结果
			rushReport() {
				request({
					url: '/wx/addReport',
					method: 'post'
				}).then(res => {
					// TOAST("")
					uni.showModal({
						title:'提示',
						content:'报告正在为您定制生成中，预计1个工作日内完成制作，请耐心等待',
						showCancel:false,
						success:function(){
							
						}
					})
					this.showBtn=false
				})
			},
			

		}

	}
</script>

<style lang="scss" scoped>
	.planContainer {
		.btns {
			display: flex;
			justify-content: space-evenly;
			align-items: center;
			margin: 20rpx;
		}
	}
	.btn {
		padding: 20rpx 0rpx;
		background: #2A6CAC;
		color: #fff;
		border-radius: 23px;
		width: 260rpx;
		text-align: center;
	}
</style>
